#include <iostream>
using namespace std;
int main(){
  int n;
  int score[10001]={0};
  cin>>n;
  
  for(int i=0;i<n;i++){
  	int m;
  	cin>>m;
  	if(m>=0 && m<=100){
  		score[m]++;
	  }
  }
  int m;
  cin>>m;
  for(int j=0;j<m;j++){
  	int temp;
  	cin>>temp;
  	if(j){
  		cout<<" "<<score[temp];
	  }else{
	  	cout<<score[temp];
	  }
  }
	cout<<endl;
	return 0;
	
	
}
